[Python-Dev] Weak references: dereference notification

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Nov 10 01:57:43 CET 2005


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 instance variables?

Your proposed scheme appears to involve destroying and
then re-initialising the Python wrapper. Isn't that
going to wipe out any instance variables it may
have had?

Also, it seems to me that as soon as the refcount on
the wrapper drops to zero, any weak references to it
will be broken. Or does your resurrection code
intervene before that happens?

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+


More information about the Python-Dev mailing list