1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-24 07:01:59 +00:00

Obtaining 'char *' from temporary Python value

Old code causes a compile error on Mint 17.2
This commit is contained in:
Thomas Harold 2015-09-12 17:21:49 -04:00
parent 31fdba089f
commit 03579ddb5a

View file

@ -37,7 +37,8 @@ cdef class IndexBase:
def __cinit__(self, capacity=0, path=None, key_size=32): def __cinit__(self, capacity=0, path=None, key_size=32):
self.key_size = key_size self.key_size = key_size
if path: if path:
self.index = hashindex_read(os.fsencode(path)) path = os.fsencode(path)
self.index = hashindex_read(path)
if not self.index: if not self.index:
raise Exception('hashindex_read failed') raise Exception('hashindex_read failed')
else: else:
@ -54,7 +55,8 @@ cdef class IndexBase:
return cls(path=path) return cls(path=path)
def write(self, path): def write(self, path):
if not hashindex_write(self.index, os.fsencode(path)): path = os.fsencode(path)
if not hashindex_write(self.index, path):
raise Exception('hashindex_write failed') raise Exception('hashindex_write failed')
def clear(self): def clear(self):