[Python-Dev] A little GC confusion

Greg Ewing greg@cosc.canterbury.ac.nz
Fri, 22 Feb 2002 15:41:29 +1300 (NZDT)


Kevin Jacobs <jacobs@penguin.theopalgroup.com>:

> I doesn't have any time to really look at your code, but I thought I'd point
> out a trick that several extension modules use to protect statically
> allocated type objects.

>         0,      /* set below */                 /* tp_alloc */
>         PySocketSock_new,                       /* tp_new */
>         0,      /* set below */                 /* tp_free */

I don't think that has anything to do with protecting the type
object.

As I understand it, static type objects are protected by
having their refcount statically initialised to 1, so that
it will never drop to zero.

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