[Patches] GC infrastructure patch 1 (tp_recurse, tp_clear)
M.-A. Lemburg
mal@lemburg.com
Wed, 21 Jun 2000 09:24:19 +0200
Neil Schemenauer wrote:
>
> On Tue, Jun 20, 2000 at 05:52:51PM -0400, Jeremy Hylton wrote:
> > This patch defines the recurse function as
> > typedef int (*recurseproc) Py_PROTO((PyObject *, visitproc, void *));
> >
> > What is the return value for?
>
> The GC doesn't need it but I thought it might be useful in the
> future.
>
> > A number of the recurse functions return 1 unless a call to
> > visit fails. Some return 1 even if a visit call returns 0.
>
> Oops, those should be fixed. tp_recurse should return 0 if any
> called visit function does (ie. it fails). The GC visit
> functions all return success (ie. 1).
>
> > It seems like it would make more sense to make it
> > typedef void (*recurseproc) Py_PROTO((PyObject *, visitproc, void *));
> >
> > Or to define the return values and be consistent about checking error
> > returns.
>
> Can anyone think of a use for the return value? I guess it could
> be added back if someone found a use of it.
... how about -1 for errors and 0 for normal operation. If you
don't provide a way to report errors then cleanup actions
won't be able to terminate prematurely.
--
Marc-Andre Lemburg
______________________________________________________________________
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/