This is an archive of the discontinued Mercurial Phabricator instance.

py3: for statprof's Chrome output, write json to string, then encode to bytes
ClosedPublic

Authored by martinvonz on Aug 31 2019, 1:35 PM.

Details

Summary

json.dump(obj, fp) requires fp.write() to accept str output, and
since the file pointer we have there only accepts bytes, we need to
change to json.dumps() and then encode as utf-8. We have already done
the same thing for the json (non-Chrome) format in 4b7eb862692e (py3:
encode json output to bytes and use write(), 2018-10-12).

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.