This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Arfrever
Recipients Arfrever, loewis
Date 2013-10-18.19:57:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1382126242.51.0.42060822734.issue19287@psf.upfronthosting.co.za>
In-reply-to
Content
__contains__()  of dbm.ndbm databases fails with str, probably since 8beaa9a37387.
This is a regression in Python 3.3.

$ python3.2 -c 'import dbm.ndbm; db=dbm.ndbm.open("/tmp/db1", "c"); db["key"]="value"; print(b"key" in db); print("key" in db)'
True
True
$ python3.3 -c 'import dbm.ndbm; db=dbm.ndbm.open("/tmp/db2", "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: dbm key must be string, not str
$ python3.4 -c 'import dbm.ndbm; db=dbm.ndbm.open("/tmp/db3", "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: dbm key must be string, not str


Also please improve error message to e.g. "dbm key must be bytes or string, not %.100s".
History
Date User Action Args
2013-10-18 19:57:22Arfreversetrecipients: + Arfrever, loewis
2013-10-18 19:57:22Arfreversetmessageid: <1382126242.51.0.42060822734.issue19287@psf.upfronthosting.co.za>
2013-10-18 19:57:22Arfreverlinkissue19287 messages
2013-10-18 19:57:22Arfrevercreate