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

Re: [PATCH] (2) Add some missing functionality to SWIG Python wrappers (issue #1451)

From: Russell Yanofsky <rey4_at_columbia.edu>
Date: 2003-08-18 15:40:53 CEST

Brandon Ehle wrote:
> * Add a typemap for svn_client_prompt_t
>
>>> * Add a typemap for log_message_receiver_t
>
> * Add a python wrapper ||svn_stream_from_pyio around svn_stream_t for
> passing python objects that have read & write methods
>
>>> * Supply a return type mapping for type svn_stream_t **
>
> * Fix a comment in svn_client.i

I finally took some time to look at this patch and I noticed a few things
that should be fixed before it is committed: (Brandon, if you're willing to
make some minor repairs, that'd be great, otherwise I can work from what you
have here.)

1. The new svn_swig_py_log_message_receiver() function duplicates the
functionality already implemented in svn_swig_py_thunk_log_receiver(). So
the
svn_log_message_receiver_t typemap should probably be changed to use the
existing function. And maybe it can be moved somewhere where it can be used
by both the _client and _repos modules.

2. Like you mentioned in another posting
(http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgId=273109), the
new svn_stream_from_pyio() function needs to be hidden from the java and
perl bindings. I think the way to do this is with #ifdef SWIGPYTHON/#endif.

3. svn_swig_py_client_prompt_func() probably should be renamed to have the
word "thunk" in it so it is more like the other forwarding functions. Maybe
svn_swig_py_thunk_client_prompt()?

4. In read_handler_pyio(), why is there an error raised when the read
handler returns fewer bytes than expected? Couldn't this be normally happen
at the end of the stream? And even if it couldn't, wouldn't this condition
be detected anyway within Subversion?

5. close_handler_pyio() should call the file object's close() method
(http://www.python.org/doc/current/lib/bltin-file-objects.html) in addition
to decrementing the reference count. Also Py_DECREF should be used instead
of Py_XDECREF since the file object associated with the stream will never be
NULL.

- Russ

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Aug 18 15:41:46 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.