◐ Shell
clean mode source ↗

Message 72963 - Python tracker

I think this isn't quite right.

Ideally a fix should maintain several important properties:

(1) Be able to read databases written by Python 2.x.

(1a) Write databases readable by Python 2.x.

(2) Use the same mapping between str and bytes as the other *dbm
libraries have.

(2a) Return the same value for keys() as the other *dbm libraries
(except for order).

I think (2) means that we should use UTF-8 to convert str keys to bytes,
but (1) means we should use Latin-1 to convert keys to str *upon writing
the index*.  This will also satisfy (1a).  The keys maintained
internally should be kept in bytes to satsfy (2a).

PS. I noticed the dbm module still returns bytearrays for keys and
values. Is there a bug open to change those to bytes?