golang_str_pickle: Fix bstr to pickle/unpickle in forward-compatible way wrt upcoming UTF-8bk
In 1ec5ed82 (golang_str_pickle: Fix it so that py3 can load what py2 saved and back) we changed how bstr and ustr are pickled so that the pickling process is explicit and that both py2/py3 can load what any of py2/py3 saved. It all works ok for that. However for protocol < 3 bstr is pickled via unicode data, with instructions to unpickle it as bstr(unicode-data). The idea is generally ok, but taking into account planned introduction of UTF-8bk (see c0a53847 "golang_str: TODO UTF-8bk" for details), it might result in bstr data saved before UTF-8b -> UTF-8bk switch, to become loaded in corrupt form after the switch. -> Care to avoid that by explicitly instructing pickle stream to always load data saved before the switch to UTF-8bk, as UTF-8b.
Showing
Please register or sign in to comment