-
Kirill Smelkov authored
Treegen.py was using bytes valv and iterating it to get tree keys to be set, but on py3 iterating bytes yields integer not bytes and so with py3 e.g. TestΔBTail was failing as --- FAIL: TestΔBTail (1.21s) panic: root['treegen/values']: key ['a']: expected str, got int64 [recovered] panic: file:///tmp/TestΔBTail1569960846/001/1.fs: @03fb8a9c91bba733: get blktab: root['treegen/values']: key ['a']: expected str, got int64 [recovered] -> Fix it by reworking treegen.py to operate in strings domain and adjusting treeenv.go loader to use pickle.AsString correspondingly. On py3 the implementation depends on nexedi/pygolang!21, but on py2 it works both with and without pygolang bstr patches. Preliminary history: vnmabus/wendelin.core@eca099bc vnmabus/wendelin.core@5a2b639c vnmabus/wendelin.core@fadc5a07 but there we were operating in mixed string/bytes mode with cluttering the code with .encode('ascii') calls and potentially missing to handle some logic right because on py3 str == bytes returns False, not raises, and with mixed types it is easy to miss some logic where conversion is needed if the outcome depends on values comparison. Switching to work in strings domain uniformly avoids those problem in principle and by doing only one thing locally. Co-authored-by: Carlos Ramos Carreño <carlos.ramos@nexedi.com>
2a2b9e30