This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author loewis
Recipients loewis, pitrou, rhettinger, stutzbach
Date 2008-12-18.06:43:46
SpamBayes Score 2.1498561e-05
Marked as misclassified No
Message-id <4949F11F.6000701@v.loewis.de>
In-reply-to <1229581522.0.0.322346179887.issue4688@psf.upfronthosting.co.za>
Content
> Unfortunately, the check is O(n), so it can get a little expensive.

Not in the typical case, I guess. *If* you have to go through all
objects, then likely you end up untracking the object. If you can't
untrack, you typically find a tracked object in the content quickly.

> I suppose that's no worse than traversing the tuple to look for a cycle,
> though.  

Correct. Collection is O(n) per object, anyway.

> Perhaps it could be done at the same time?
> Can _PyObject_GC_UNTRACK() be safely called from tp_traverse?

No. However, I doubt that iterating over the object twice is
significantly slower than iterating over it once and performing
both checks. Plus, the check for tracked elements can return
as soon as one such object is found.
History
Date User Action Args
2008-12-18 06:43:48loewissetrecipients: + loewis, rhettinger, pitrou, stutzbach
2008-12-18 06:43:47loewislinkissue4688 messages
2008-12-18 06:43:46loewiscreate