Any experts on Python bindings on this list? :) Could this at least be confirmed to be a bug, so that I could enter it into issues database?
Regards, Alexey On Thursday 04 March 2010 01:40:56 pm Alexey Neyman wrote: > 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? > > Regards, > Alexey.