[New-bugs-announce] [issue19288] __contains__() of dbm.gnu databases fails with str

Arfrever Frehtes Taifersar Arahesis report at bugs.python.org
Fri Oct 18 22:23:13 CEST 2013


New submission from Arfrever Frehtes Taifersar Arahesis:

__contains__()  of dbm.gnu databases fails with str.
This is inconsistent with other databases (dbm.ndbm (issue #19287) and dbm.dumb).


$ python3.2 -c 'import dbm.ndbm; db=dbm.ndbm.open("/tmp/ndbm_db", "c"); db["key"]="value"; print(b"key" in db); print("key" in db)'
True
True
$ python3.4 -c 'import dbm.dumb; db=dbm.dumb.open("/tmp/dumb_db", "c"); db["key"]="value"; print(b"key" in db); print("key" in db)'
True
True
$ python3.4 -c 'import dbm.gnu; db=dbm.gnu.open("/tmp/gdbm_db", "c"); db["key"]="value"; print(b"key" in db); print("key" in db)'
True
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: gdbm key must be bytes, not str

----------
components: Library (Lib)
messages: 200305
nosy: Arfrever
priority: normal
severity: normal
status: open
title: __contains__()  of dbm.gnu databases fails with str
versions: Python 3.3, Python 3.4

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


More information about the New-bugs-announce mailing list