You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Stein <gs...@lyra.org> on 2002/10/31 10:10:16 UTC

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

On Wed, Oct 30, 2002 at 12:39:48AM -0600, cmpilato@tigris.org wrote:
>...
> +++ trunk/subversion/bindings/swig/svn_client.i	Wed Oct 30 00:39:48 2002
> @@ -37,6 +37,34 @@
>  };
>  
>  /* -----------------------------------------------------------------------
> +   make return commit item structures magically turn into a 3-tuple of
> +   (rev, datestring, author).
> +*/
> +%typemap(python,argout,fragment="t_output_helper") svn_client_commit_info_t **
> +{       
> +    PyObject *list;
> +    PyObject *rev, *date, *author;
> +    if (!(*$1)) {
> +        return Py_None;

Shouldn't that be $result = Py_None?

And this must be INCREF'd.

> +    list = PyList_New(3);
> +    rev = PyInt_FromLong((*$1)->revision);
> +    date = PyString_FromString((*$1)->date);
> +    author = PyString_FromString((*$1)->author);
> +    if (!(list && rev && date && author)) {
> +        Py_XDECREF(rev);
> +        Py_XDECREF(date);
> +        Py_XDECREF(author);
> +        Py_DECREF(list);

list could be NULL also, so this should be an XDECREF.

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

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

Posted by cm...@collab.net.
Greg Stein <gs...@lyra.org> writes:

> >  /* -----------------------------------------------------------------------
> > +   make return commit item structures magically turn into a 3-tuple of
> > +   (rev, datestring, author).
> > +*/
> > +%typemap(python,argout,fragment="t_output_helper") svn_client_commit_info_t **
> > +{       
> > +    PyObject *list;
> > +    PyObject *rev, *date, *author;
> > +    if (!(*$1)) {
> > +        return Py_None;
> 
> Shouldn't that be $result = Py_None?

Heh.  Yep.  This code originally lived in swigutil.c, and I missed
that in the cut-n-paste.

> And this must be INCREF'd.

Gotcha.

> > +    list = PyList_New(3);
> > +    rev = PyInt_FromLong((*$1)->revision);
> > +    date = PyString_FromString((*$1)->date);
> > +    author = PyString_FromString((*$1)->author);
> > +    if (!(list && rev && date && author)) {
> > +        Py_XDECREF(rev);
> > +        Py_XDECREF(date);
> > +        Py_XDECREF(author);
> > +        Py_DECREF(list);
> 
> list could be NULL also, so this should be an XDECREF.

Cha-ching -- that registers ;-)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org