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

Ctypes-python Stream callback function crashes

From: Julian Foad <julian.foad_at_wandisco.com>
Date: Wed, 17 Aug 2011 13:55:04 +0100

In the ctypes-python bindings, when I try to use the Stream class
(either via the RemoteRepository.cat() method, or just on its own), I
find that the program crashes at the moment the C code in
svn_stream_write() calls the callback function which is provided by
subversion/bindings/ctypes-python/csvn/types.py:240:

> class Stream(object):
>
> def __init__(self, buffer, disown=False):
> [...]
> svn_stream_set_read(self.stream, svn_read_fn_t(self._read))
>
> def _write(self, baton, data, l):
> [...]

So, using the attached patch (with or without the experimental edits it
contains in _read() and _write()), I find the tests suite bombs out
without reporting any results. My usage of GDB and the Python debugger
pdb indicates that _write() is never reached.

If I write a test using a ctypes callback type with the C standard
library's qsort(), as shown in the Python ctypes module documentation
<http://docs.python.org/library/ctypes.html#callback-functions>, that
works fine for me.

I wonder if something is wrong with my building and linking of ctypesgen
or the ctypes-python bindings, but on the other hand the obvious bug in
Stream._read() where 'string' is referenced instead of 's' (see my
patch) makes me wonder if this class has ever worked.

Another data point: the log message receiver callback seems to work fine
for me, as tested in
subversion/bindings/ctypes-python/test/remoterepos.py:test_log().

- Julian

Received on 2011-08-17 14:55:43 CEST

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.