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

Re: Subversion SWIG patch.

From: Greg Stein <gstein_at_lyra.org>
Date: 2002-09-17 19:11:15 CEST

On Tue, Sep 17, 2002 at 10:22:00AM +0200, Michael Wood wrote:
> On Mon, Sep 16, 2002 at 03:27:33PM -0500, cmpilato@collab.net wrote:
> [snip]
> > %typemap(arginit) apr_pool_t *pool(apr_pool_t *_global_pool) {
> > if (SWIG_ConvertPtr(PyObject_GetItem(args, PyInt_FromLong($argnum)),
> > (void **)&$1, $1_descriptor, 0) == -1) {
> > return NULL;
> > }
> > _global_pool = $1;
> > }
> > %typemap(in) apr_pool_t *pool "";
> [snip]
>
> I've only played around with SWIG and Python C bindings a little, but
> shouldn't that "return NULL;" be something like this instead:
>
> Py_INCREF(Py_None); return PyNone;

Nope. If the ConvertPtr fails, then it raises a Python exception. The
presence of an exception is signalled to the caller by returning NULL.

(and Python int-valued functions will return -1 to signal this; if -1 is a
 legal return value, then you test for -1 and then test for an exception)

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 Tue Sep 17 19:12:01 2002

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