[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: Greg Stein <gstein_at_lyra.org>
Date: 2003-02-28 00:50:39 CET

On Thu, Feb 27, 2003 at 02:44:33PM -0800, Marshall White wrote:
> Yes they are *exactly* the same types of problem.
>
> I still haven't captured the error message, and based on this I don't think I need to.
>
> My 2 cents:
> I agree that returning an empty string and returning a "None" object are fundamentally different.

Right. NULL should map to None. An empty string in C should map to the same
in Python. This rule should apply everywhere...

> However that seemed like an easy way to work around the problem involving a "const char **".
>
> I would pose this hypothetical situation:
> 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.

If there is a potential for None, then we should avoid t_output_helper().
Any function that has such a signature should be able to override the
typemap-based return mechanism and specify something that manually
constructs a return tuple.

And to be concrete: this is exactly what we should figure out for the
commit_txn function. The pattern can then be replicated to other functions
as we find them.

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 Fri Feb 28 00:46:04 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.