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

Re: Bug with svn_txdelta_window_t Python binding?

From: Роман Донченко <DXDragon_at_yandex.ru>
Date: Sun, 07 Mar 2010 20:56:31 +0300

Alexey Neyman <stilor_at_att.net> писал в своём письме Fri, 05 Mar 2010
00:40:56 +0300:

> Hi all,
>
> It looks like there's a bug with Python binding for the
> svn_txdelta_window_t structure. The problem is that the 'ops' array is
> mapped to Python as a single object, not as a sequence of 'num_ops'
> items. That is, the following code for apply_textdelta does not work:
>
> def apply_textdelta(self, file_baton, base_checksum):
> self.dbg(("apply_textdelta to %s" % (file_baton[0])))
> def txdelta_handler(window):
> if window is None:
> self.dbg("txdelta - stop")
> else:
> self.dbg(("txdelta - %s [%d,%d] [X,%d] %d %d" %
> (file_baton[0], window.sview_offset, window.sview_len,
> window.tview_len, window.src_ops, window.num_ops)))
> for o in window.ops:
> self.dbg((" op: %d,%d,%d" % (o.action_code, o.offset,
> o.length)))
> return txdelta_handler
>
> It fails with the error that "for o in window.ops: TypeError: iteration
> over non-sequence". The following code works, but it can only access the
> first item in the 'ops' array:
>
> self.dbg((" op: %d,%d,%d" %
> (window.ops.action_code, window.ops.offset, window.ops.length)))
>
> I am not a SWIG expert; could someone confirm if it's a bug in SWIG
> Python
> bindings?

Confirmed. Since 'ops' is declared as a const svn_txdelta_op_t *, SWIG
can't automatically deduce that it's an array. I'll see what I can do.

By the way, can you submit a complete test case? It would tremendously
help to fix this.

Thanks,
Roman.
Received on 2010-03-07 18:57:21 CET

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.