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

Bug with svn_txdelta_window_t Python binding?

From: Alexey Neyman <stilor_at_att.net>
Date: Thu, 4 Mar 2010 13:40:56 -0800

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")
      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

Received on 2010-03-04 22:41:33 CET

This is an archived mail posted to the Subversion Dev mailing list.