Permalink
Browse files

Only release non-NULL snapshots when deallocating

When running under Pypy, the ReleaseSnapshot method sometimes segfaults
because the _snapshot pointer is NULL, most likely due to refcount/gc
differences from CPython.
  • Loading branch information...
1 parent 46d68ca commit 763f7f052836d317378220d6899ba567a219108a @wbolster committed Nov 26, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 plyvel/_plyvel.pyx
View
@@ -933,7 +933,7 @@ cdef class Snapshot:
def __dealloc__(self):
with nogil:
- if self.db._db is not NULL:
+ if self.db._db is not NULL and self._snapshot is not NULL:
self.db._db.ReleaseSnapshot(self._snapshot)
def get(self, bytes key, *, verify_checksums=None, fill_cache=None):

0 comments on commit 763f7f0

Please sign in to comment.