[issue19385] dbm.dumb should be consistent when the database is closed

Claudiu.Popa report at bugs.python.org
Fri Oct 25 08:38:41 CEST 2013


New submission from Claudiu.Popa:

This problem occurred in issue19282. Basicly, dbm.dumb is not consistent with dbm.gnu and dbm.ndbm when the database is closed, as seen in the following:


>>> import dbm.dumb as d
>>> db = d.open('test.dat', 'c')
>>> db.close()
>>> db.keys()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tank/libs/cpython/Lib/dbm/dumb.py", line 212, in keys
    return list(self._index.keys())
AttributeError: 'NoneType' object has no attribute 'keys'
>>>

vs

>>> import dbm.gnu as g
>>> db = g.open('test.dat', 'c')
>>> db.close()
>>> db.keys()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
_gdbm.error: GDBM object has already been closed
>>>

Attaching a patch.

----------
components: Library (Lib)
messages: 201209
nosy: Claudiu.Popa
priority: normal
severity: normal
status: open
title: dbm.dumb should be consistent when the database is closed
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19385>
_______________________________________


More information about the Python-bugs-list mailing list