[New-bugs-announce] [issue31398] TypeError: gdbm key must be string, not unicode

sds report at bugs.python.org
Fri Sep 8 16:54:57 EDT 2017


New submission from sds:

`in` and `has_key` have different behavior for Unicode keys for `gdbm` in 2.7:
```
>>> import gdbm
>>> db = gdbm.open("foo.gdbm","c")
>>> db.has_key("a")
0
>>> db.has_key(u"a")
0
>>> "a" in db
False
>>> u"a" in db
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: gdbm key must be string, not unicode
```

----------
components: Unicode
messages: 301728
nosy: ezio.melotti, haypo, sam-s
priority: normal
severity: normal
status: open
title: TypeError: gdbm key must be string, not unicode
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31398>
_______________________________________


More information about the New-bugs-announce mailing list