From b69e798de2b182dbe4ec4a2df722d49604164e95 Mon Sep 17 00:00:00 2001 From: qiupengfei Date: Tue, 28 May 2019 20:15:56 +0800 Subject: [PATCH 1/3] Fix for python 2.7: Exception AttributeError: "'list' object has no attribute 'clear'" in 'rocksdb._rocksdb.DB.__dealloc__' ignored --- rocksdb/_rocksdb.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rocksdb/_rocksdb.pyx b/rocksdb/_rocksdb.pyx index edd856a..9ca296d 100644 --- a/rocksdb/_rocksdb.pyx +++ b/rocksdb/_rocksdb.pyx @@ -1672,7 +1672,7 @@ cdef class DB(object): def __dealloc__(self): self.close() - + def close(self): cdef ColumnFamilyOptions copts if not self.db == NULL: @@ -1682,7 +1682,7 @@ cdef class DB(object): for copts in self.cf_options: if copts: copts.in_use = False - self.cf_options.clear() + self.cf_options = [] with nogil: del self.db From 4e0a7140d60ff2e5ef26da17a12e72581cd67cc3 Mon Sep 17 00:00:00 2001 From: qiupengfei Date: Tue, 28 May 2019 20:31:55 +0800 Subject: [PATCH 2/3] Fix for python 2.7: Exception AttributeError: "'list' object has no attribute 'clear'" in 'rocksdb._rocksdb.DB.__dealloc__' ignored --- rocksdb/_rocksdb.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rocksdb/_rocksdb.pyx b/rocksdb/_rocksdb.pyx index 9ca296d..4e291f5 100644 --- a/rocksdb/_rocksdb.pyx +++ b/rocksdb/_rocksdb.pyx @@ -1678,7 +1678,7 @@ cdef class DB(object): if not self.db == NULL: # We have to make sure we delete the handles so rocksdb doesn't # assert when we delete the db - self.cf_handles.clear() + self.cf_handles = [] for copts in self.cf_options: if copts: copts.in_use = False From 0c351c58d0f35fa9cbe05aff31aa8347347624e3 Mon Sep 17 00:00:00 2001 From: qiupengfei Date: Tue, 28 May 2019 20:36:11 +0800 Subject: [PATCH 3/3] Fix for python 2.7: Exception AttributeError: "'list' object has no attribute 'clear'" in 'rocksdb._rocksdb.DB.__dealloc__' ignored --- rocksdb/_rocksdb.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rocksdb/_rocksdb.pyx b/rocksdb/_rocksdb.pyx index 4e291f5..5a2d0c9 100644 --- a/rocksdb/_rocksdb.pyx +++ b/rocksdb/_rocksdb.pyx @@ -1678,11 +1678,11 @@ cdef class DB(object): if not self.db == NULL: # We have to make sure we delete the handles so rocksdb doesn't # assert when we delete the db - self.cf_handles = [] + del self.cf_handles[:] for copts in self.cf_options: if copts: copts.in_use = False - self.cf_options = [] + del self.cf_options[:] with nogil: del self.db