Fix Python 3.x compatibility issues with demarshalling Perforce data.
Review Request #10666 — Created Aug. 21, 2019 and submitted — Latest diff uploaded
When we call out to
p4, we often request data in a marshalled form.
These come back as byte strings, and on Python 3.x, this prevents us
from properly looking up all sorts of data from them (error results,
change status, etc.). We had a single place that attempted to handle
this, which was the fetching of a change description, but nowhere else.
We now normalize the string types before we hand it back to the caller,
ensuring that all keys and string values are Unicode. This is based in
part on Perforce's own documentation on demarshalling on Python 3.x
(though fixes an issue they have involving int values, found in error
Ran a handful of tests locally, including
commands, testing againt Perforce change numbers and with change
descriptions utilizing various Unicode characters (including Emoji).
While these failed before (with
rbt postclaiming the path was
rbt diffjust raising a
KeyError), both now work