Re: [Python-Dev] Weak references: dereference notification

2005-11-11 Thread Greg Ewing
Gustavo J. A. M. Carneiro wrote: The object isn't really destroyed. Simply ob_refcnt drops to zero, then tp_dealloc is called, which is supposed to destroy it. But since I wrote tp_dealloc, I choose not to destroy it, Be aware that a C subclass of your wrapper that overrides tp_dealloc is

Re: [Python-Dev] Weak references: dereference notification

2005-11-10 Thread Gustavo J. A. M. Carneiro
Qui, 2005-11-10 às 13:57 +1300, Greg Ewing escreveu: Gustavo J. A. M. Carneiro wrote: OK, but what if it is a subclass of a builtin type, with instance variables? What if the PyObject is GC'ed but the ObjC object remains alive, and later you get a new reference to it? Do you create a

[Python-Dev] Weak references: dereference notification

2005-11-09 Thread Gustavo J. A. M. Carneiro
Hello, I have come across a situation where I find the current weak references interface for extension types insufficient. Currently you only have a tp_weaklistoffset slot, pointing to a PyObject with weak references. However, in my case[1] I _really_ need to be notified when a weak

Re: [Python-Dev] Weak references: dereference notification

2005-11-09 Thread Guido van Rossum
Gustavo J. A. M. Carneiro wrote: I have come across a situation where I find the current weak references interface for extension types insufficient. Currently you only have a tp_weaklistoffset slot, pointing to a PyObject with weak references. However, in my case[1] I

Re: [Python-Dev] Weak references: dereference notification

2005-11-09 Thread Gustavo J. A. M. Carneiro
Qua, 2005-11-09 às 09:23 -0800, Guido van Rossum escreveu: Gustavo J. A. M. Carneiro wrote: I have come across a situation where I find the current weak references interface for extension types insufficient. Currently you only have a tp_weaklistoffset slot, pointing to a

Re: [Python-Dev] Weak references: dereference notification

2005-11-09 Thread Ronald Oussoren
On 9-nov-2005, at 18:52, Gustavo J. A. M. Carneiro wrote: Qua, 2005-11-09 às 09:23 -0800, Guido van Rossum escreveu: Gustavo J. A. M. Carneiro wrote: I have come across a situation where I find the current weak references interface for extension types insufficient. Currently you only

Re: [Python-Dev] Weak references: dereference notification

2005-11-09 Thread Gustavo J. A. M. Carneiro
On Wed, 2005-11-09 at 20:40 +0100, Ronald Oussoren wrote: On 9-nov-2005, at 18:52, Gustavo J. A. M. Carneiro wrote: Qua, 2005-11-09 às 09:23 -0800, Guido van Rossum escreveu: Gustavo J. A. M. Carneiro wrote: I have come across a situation where I find the current weak references

Re: [Python-Dev] Weak references: dereference notification

2005-11-09 Thread Greg Ewing
Gustavo J. A. M. Carneiro wrote: OK, but what if it is a subclass of a builtin type, with instance variables? What if the PyObject is GC'ed but the ObjC object remains alive, and later you get a new reference to it? Do you create a new PyObject wrapper for it? What happened to the

Re: [Python-Dev] Weak references: dereference notification

2005-11-09 Thread Ronald Oussoren
On 9-nov-2005, at 23:44, Gustavo J. A. M. Carneiro wrote: On Wed, 2005-11-09 at 20:40 +0100, Ronald Oussoren wrote: On 9-nov-2005, at 18:52, Gustavo J. A. M. Carneiro wrote: Qua, 2005-11-09 às 09:23 -0800, Guido van Rossum escreveu: Gustavo J. A. M. Carneiro wrote: I have come across a

Re: [Python-Dev] Weak references: dereference notification

2005-11-09 Thread Martin v. Löwis
Gustavo J. A. M. Carneiro wrote: OK, but what if it is a subclass of a builtin type, with instance variables? What if the PyObject is GC'ed but the ObjC object remains alive, and later you get a new reference to it? Do you create a new PyObject wrapper for it? What happened to the