cloudant-labs / cloudant-python

Asynchronous Cloudant / CouchDB interface for Python
http://cloudant-labs.github.io/cloudant-python/
37 stars 17 forks source link

Document.__del__ called when object garbage collected, not just when `del doc` #37

Closed nirvinehh closed 10 years ago

nirvinehh commented 10 years ago

I think this method should be __delitem__(_id) on Database. __del__ gets called on garbage collection:

>>> class Foo(object):
...     def __del__(self):
...         print '__del__'
...
>>> def make_foo():
...     f = Foo()
...
>>> make_foo()
__del__

The tests pass because __del__ represses exceptions.

garbados commented 10 years ago

Oh jeez, good point. Will fix.

garbados commented 10 years ago

Fixed here: 04609664e32f330a781bfb7a11a198f66980e30a

Thanks for raising the issue!