twmht / python-rocksdb

Python bindings for RocksDB
BSD 3-Clause "New" or "Revised" License
276 stars 88 forks source link

Fix for python 2.7: Exception AttributeError: "'list' object has no a… #54

Open penfree opened 5 years ago

penfree commented 5 years ago

AttributeError: 'list' object has no attribute 'clear' Exception AttributeError: "'list' object has no attribute 'clear'" in 'rocksdb._rocksdb.DB.dealloc' ignored

iFA88 commented 5 years ago

Hi. del variable[:] Should be the correct method for .clear(), and then is python 2 compatible.

iFA88 commented 5 years ago
>>> data = [1,2,3]
>>> ptr = data
>>> del data[:]
>>> ptr.append(4)
>>> data
[4]
>>> 
>>> 
>>> data = [1,2,3]
>>> ptr = data
>>> data = []
>>> ptr.append(4)
>>> data
[]
penfree commented 5 years ago

Hi. del variable[:] Should be the correct method for .clear(), and then is python 2 compatible.

ok, i have modified

oersted commented 5 years ago

Is there an alternative to properly deallocate the DB object in Python 2 from outside until this is released?

penfree commented 5 years ago

Is there an alternative to properly deallocate the DB object in Python 2 from outside until this is released?

pip install -U https://github.com/penfree/python-rocksdb/archive/master.zip

you can just use my branch or fork and fix it before new release