[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: rev 7349 - trunk/subversion/bindings/swig

From: Greg Stein <gstein_at_lyra.org>
Date: 2003-10-08 14:34:22 CEST

On Wed, Oct 08, 2003 at 12:56:35AM -0500, rey4@tigris.org wrote:
>...
> +++ trunk/subversion/bindings/swig/swigutil_py.c Wed Oct 8 00:56:28 2003
>...
> +/* Thunked version of svn_wc_status_func_t callback type. */
> +void svn_swig_py_status_func(void *baton,
> + const char *path,
> + svn_wc_status_t *status)
> +{
> + PyObject *function = baton;
> + PyObject *result;
> +
> + if (function == NULL || function == Py_None)
> + return;
> +
> + acquire_py_lock();
> + /* ### shouldn't we set an exception if this fails? */

Nope. The status callback has a "void" return type. It doesn't want any
errors to be raised.

That said, it is an interesting question: may it *should* return an error.

> + if ((result = PyObject_CallFunction(function, (char *)"sO&", path,
> + make_ob_status, status)) != NULL)
> + {
> + Py_DECREF(result);
> }

I'd restructure as:

    if ((result = PyObject_CallFunction(...)) == NULL)
      {
        /* ignore the exception that was raised */
        PyErr_Clear();
      }
    else
      {
        Py_DECREF(result);
      }

You *really* don't want to leave an exception hanging about.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Oct 8 14:38:54 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.