Gustavo J. A. M. Carneiro wrote:
>   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 reference is dereferenced.  What happens now
> is that, when you call a weakref object, a simple Py_INCREF is done on
> the referenced object.  It would be easy to implement a new slot to
> contain a function that should be called when a weak reference is
> dereferenced.  Or, alternatively, a slot or class attribute that
> indicates an alternative type that should be used to create weak
> references: instead of the builtin weakref object, a subtype of it, so
> you can override tp_call.
> 
>   Does this sounds acceptable?

Since you can now (as of 2.4) subclass the weakref.ref class, you should be 
able to
do this yourself in Python.  See for example, weakref.KeyedRef.

Jim

-- 
Jim Fulton           mailto:[EMAIL PROTECTED]       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to