]> git.michaelhowe.org Git - packages/b/bup.git/commitdiff
In some versions of python, comparing buffers with < gives a warning.
authorAvery Pennarun <apenwarr@gmail.com>
Sun, 24 Jan 2010 22:46:51 +0000 (17:46 -0500)
committerAvery Pennarun <apenwarr@gmail.com>
Sun, 24 Jan 2010 22:59:28 +0000 (17:59 -0500)
It seems to be a buggy warning.  But we only really do it in one place, and
buffers in question are only 20 bytes long, so forcing them into strings
seems harmless enough.

git.py

diff --git a/git.py b/git.py
index 684bd5e6b645290ff01a7be8d1401da5d1ee0670..a94f53c13886c1444c958a3a0e64800d3cf2d236 100644 (file)
--- a/git.py
+++ b/git.py
@@ -151,10 +151,10 @@ class PackIndex:
         start = self.fanout[b1-1] # range -1..254
         end = self.fanout[b1] # range 0..255
         buf = buffer(self.map, 8 + 256*4, end*20)
-        want = buffer(hash)
+        want = str(hash)
         while start < end:
             mid = start + (end-start)/2
-            v = buffer(buf, mid*20, 20)
+            v = str(buf[mid*20:(mid+1)*20])
             if v < want:
                 start = mid+1
             elif v > want: