[Python-Dev] Re: tp_clear return value (original) (raw)

Tim Peters tim.one@comcast.net
Thu, 10 Apr 2003 22:49:01 -0400


[Greg Ewing]

But what about the visit function? You need to take account of what it might do as well. And if it's ever used for something beside GC, it could do anything.

I don't see the relevance. The visit functions are where the longjmps would go, if a visit function felt like using one. Two visit functions in gcmodule.c would use them, the other visit functions in gcmodule.c would not. I don't know of any visit functions not in gcmodule.c (where they all have static scope), nor do I expect to see any outside of gcmodule.c -- visit functions are Python internals. tp_clear and tp_traverse functions must be supplied by extension authors who want their types to play with the gc system, but extension authors are never required (or even asked) to write a visit function.