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

Re: inconsistency in Python SWIG return parameters

From: Marshall White <cscidork_at_yahoo.com>
Date: 2003-02-28 00:24:21 CET

Going back to the "work-around" in "_commit_internal": That "work-around" only works because we
know that the only value it MIGHT skip is the first one and that the other value is some other
"non-pointer" type.
What if THEY had both been pointers of the same type? What then if both were NULL?

My question was supposed an example of exactly that. It was also to be taken in the context of
the current "t_output_helper" madness of dropping objects of type "Py_None".
In other words, the Python script would only get ONE return value in my example.
That leads to the question, how would the script know WHICH one was just returned? Maybe it was
the first one... Maybe it was the third one...
In fact if all three pointers are NULL, there will be NO return value from this hypothetical

It looks to me like one possible culprit, this funky "t_output_helper", is generated by SWIG.

From reading I see that Dale Hirt is looking into this.
I wish him the best of luck. Perhaps there are command line options for SWIG that might change
the default behavior of this function. A very quick glance didn't show anything obvious though.

I don't want to *duplicate* his effort, but I will look into this some myself. Maybe two sets of
eyes might be better than one.


--- Karl Fogel <kfogel@newton.ch.collab.net> wrote:
> Marshall White <cscidork@yahoo.com> writes:
> > What if you have a function that returns three object pointers of
> > the same type?
> > If the function tries to return (None, "some pointer", None), how
> > does the Python script know which one was just returned?
> >
> > It almost doesn't look like there is an easy answer here.
> Why not just return
> (None, SOME_OBJECT, None)
> then? We know what number of return values we're expecting, so it
> should be okay if some of them are None, no?
> -K

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Feb 28 00:25:07 2003

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