[pypy-svn] r66665 - pypy/branch/pyjitpl5/pypy/lib
arigo at codespeak.net
arigo at codespeak.net
Wed Jul 29 15:18:37 CEST 2009
Author: arigo
Date: Wed Jul 29 15:18:36 2009
New Revision: 66665
Modified:
pypy/branch/pyjitpl5/pypy/lib/dbm.py
Log:
Add a __del__ method to force a call to funcs['close'].
Modified: pypy/branch/pyjitpl5/pypy/lib/dbm.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/lib/dbm.py (original)
+++ pypy/branch/pyjitpl5/pypy/lib/dbm.py Wed Jul 29 15:18:36 2009
@@ -25,6 +25,10 @@
getattr(lib, funcs['close'])(self._aobj)
self._aobj = None
+ def __del__(self):
+ if self._aobj:
+ self.close()
+
def keys(self):
if not self._aobj:
raise error('DBM object has already been closed')
More information about the Pypy-commit
mailing list