This is an archive of the discontinued Mercurial Phabricator instance.

py3: cast exception to bytes
ClosedPublic

Authored by indygreg on Sep 24 2018, 11:32 PM.

Details

Reviewers
None
Group Reviewers
hg-reviewers
Commits
rHG69b4a5b89dc5: py3: cast exception to bytes
Summary

This was raising a TypeError on Python 3 and preventing most (all?)
wireprotov2 commands from working.

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.Sep 24 2018, 11:32 PM
yuja added a subscriber: yuja.Sep 25 2018, 9:22 AM

@@ -319,7 +319,8 @@

except Exception as e:
    action, meta = reactor.onservererror(
        outstream, command['requestid'],
  • _('exception when invoking command: %s') % e)

+ _('exception when invoking command: %s') %
+ pycompat.sysbytes(str(e)))

Nit: stringutil.forcebytestr(e) is better since it can handle platform
strings.

indygreg updated this revision to Diff 11349.Sep 25 2018, 12:13 PM
This revision was automatically updated to reflect the committed changes.