This is an archive of the discontinued Mercurial Phabricator instance.

py3: encode JSON str to bytes
ClosedPublic

Authored by indygreg on Oct 12 2018, 4:09 AM.

Details

Summary

json.dumps() will emit UTF-8 str on Python 2 and 3. Use sysbytes to
force the .encode('utf-8') on Python 3 and no-op on Python 2.

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.

Event Timeline

indygreg created this revision.Oct 12 2018, 4:09 AM
pulkit accepted this revision.Oct 12 2018, 4:20 AM
This revision was automatically updated to reflect the committed changes.