X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=git.py;h=ec60ae45b98c9af4fc7fab3d8dc5f27b48eb1877;hb=ba4d48af99077d191315b0f7503ab968c2546e22;hp=4f9c5e4379342a69304724edfaa1f8444ab87c91;hpb=1fbc13ae740b04e7d14be08b875e42d85e1c1e90;p=bup.git diff --git a/git.py b/git.py index 4f9c5e4..ec60ae4 100644 --- a/git.py +++ b/git.py @@ -20,7 +20,8 @@ class PackIndex: mmap.MAP_SHARED, mmap.PROT_READ) f.close() # map will persist beyond file close assert(str(self.map[0:8]) == '\377tOc\0\0\0\2') - self.fanout = list(struct.unpack('!256I', buffer(self.map, 8, 256*4))) + self.fanout = list(struct.unpack('!256I', + str(buffer(self.map, 8, 256*4)))) self.fanout.append(0) # entry "-1" nsha = self.fanout[255] self.ofstable = buffer(self.map, @@ -30,10 +31,11 @@ class PackIndex: 8 + 256*4 + nsha*20 + nsha*4 + nsha*4) def _ofs_from_idx(self, idx): - ofs = struct.unpack('!I', buffer(self.ofstable, idx*4, 4))[0] + ofs = struct.unpack('!I', str(buffer(self.ofstable, idx*4, 4)))[0] if ofs & 0x80000000: idx64 = ofs & 0x7fffffff - ofs = struct.unpack('!I', buffer(self.ofs64table, idx64*8, 8))[0] + ofs = struct.unpack('!I', + str(buffer(self.ofs64table, idx64*8, 8)))[0] return ofs def _idx_from_hash(self, hash):