This is an archive of the discontinued Mercurial Phabricator instance.

py3: fully fix bundlepart.__repr__ to return str not bytes
ClosedPublic

Authored by spectral on Feb 6 2020, 6:55 PM.

Details

Summary

My previous fix did not fully fix the issue: it would attempt to use
%-formatting to combine two strs into a bytes, which won't work. Let's just
switch the entire function to operating in strs. This can cause a small output
difference that will likely not be noticed since no one noticed that the method
wasn't working at all before: if id or type are not-None, they'll be shown
as b'val' instead of val. Since this is a debugging aid and these strings
shouldn't be shown to the user, slightly rough output is most likely fine and
it's likely not worthwhile to add the necessary conditionals to marginally
improve it.

Diff Detail

Repository
rHG Mercurial
Branch
stable
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

spectral created this revision.Feb 6 2020, 6:55 PM
marmoute accepted this revision.Feb 7 2020, 1:43 PM
marmoute added a subscriber: marmoute.

I guess we could build the string, and then turn it into a bytes. That seems simple enough to be worth doing. Howevr you are fixing a bug here and as you poitned out, this __repr__ is not really important. So you get a stamp.

pulkit accepted this revision.Feb 7 2020, 3:20 PM
This revision is now accepted and ready to land.Feb 7 2020, 3:20 PM