Decoded field tables have byte string keys in Python3
everilae opened this issue · 1 comments
everilae commented
Now, this could be by-design and if so, please close this issue forthwith... but:
Looking at _maybe_utf8
one gets the picture that keys would be decoded to unicode strings, if they are utf-8 byte strings. As it turns out, this is not the case. For example:
>>> pamqp.decode.field_table(pamqp.encode.field_table({'A': 1}))
(9, {b'A': 1})
I think it's not quite far-fetched that this will confuse PY3 users, who have to handle encoding key values at the receiving end, or suffer KeyError
s in order to find out that they must use bytes.
gmr commented
Addressed in 1.7, thanks!