[Python-Dev] Re: tp_clear return value

Neil Schemenauer nas@python.ca
Wed, 9 Apr 2003 14:41:04 -0700

"Martin v. L?wis" wrote:
> Neil Schemenauer wrote:
> >In retrospect, I think both tp_traverse and tp_clear should have
> >returned "void".  
> While this is true for tp_clear, tp_traverse is actually more general.
> gc.get_referrers uses tp_traverse, for something other than collection.

Could the visit procedure keep track of errors?  Something like:

    struct result {
        int error; /* true if an error occured while traversing */
        /* other results */

    static void
    myvisit(PyObject* obj, struct result *r)
        if (!r->error) {
            <do stuff, set r->error of error occurs>