[Python-Dev] Re: tp_clear return value

Martin v. L÷wis martin@v.loewis.de
11 Apr 2003 07:08:56 +0200


Tim Peters <tim.one@comcast.net> writes:

> So I'm unclear on what we're trying to optimize when a tp_clear nukes less
> than the corresponding tp_traverse visits.  I suppose "code space" is one
> decent answer to that.

In the case of type objects, it's not a matter of optimization but of
correctness. If you were clearing all slots of a type object, you'd
lose state that is still needed later on; see the comment for
typeobject.c:2.150.

Regards,
Martin