Skip to content

Instantly share code, notes, and snippets.

@ThomasWaldmann
Created September 12, 2015 21:19
Show Gist options
  • Save ThomasWaldmann/a6611d97c746fb85bc6c to your computer and use it in GitHub Desktop.
Save ThomasWaldmann/a6611d97c746fb85bc6c to your computer and use it in GitHub Desktop.
trying to fix cython error msg
diff --git a/borg/hashindex.pyx b/borg/hashindex.pyx
index 6652e05..0b4dc26 100644
--- a/borg/hashindex.pyx
+++ b/borg/hashindex.pyx
@@ -37,7 +37,8 @@ cdef class IndexBase:
def __cinit__(self, capacity=0, path=None, key_size=32):
self.key_size = key_size
if path:
- self.index = hashindex_read(os.fsencode(path))
+ path = os.fsencode(path)
+ self.index = hashindex_read(path)
if not self.index:
raise Exception('hashindex_read failed')
else:
@@ -54,7 +55,8 @@ cdef class IndexBase:
return cls(path=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')
def clear(self):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment