( )⚙ D11467 encoding: force a few Errors to bytes before passing to `error.Abort`

This is an archive of the discontinued Mercurial Phabricator instance.

encoding: force a few Errors to bytes before passing to `error.Abort`
ClosedPublic

Authored by mharbison72 on Sep 21 2021, 11:38 AM.

Details

Summary

I'm not sure what changed before pytype 09-09-2021 (from 04-15-2021), but these
started getting flagged. PyCharm also flagged these. This fixes the following:

File "/mnt/c/Users/Matt/hg/mercurial/encoding.py", line 243, in fromlocal: Function Abort.__init__ was called with the wrong arguments [wrong-arg-types]
         Expected: (self, message: Union[bytearray, bytes, memoryview], ...)
  Actually passed: (self, message: LookupError, ...)
File "/mnt/c/Users/Matt/hg/mercurial/encoding.py", line 309, in lower: Function Abort.__init__ was called with the wrong arguments [wrong-arg-types]
         Expected: (self, message: Union[bytearray, bytes, memoryview], ...)
  Actually passed: (self, message: LookupError, ...)
File "/mnt/c/Users/Matt/hg/mercurial/encoding.py", line 336, in upperfallback: Function Abort.__init__ was called with the wrong arguments [wrong-arg-types]
         Expected: (self, message: Union[bytearray, bytes, memoryview], ...)
  Actually passed: (self, message: LookupError, ...)
Called from (traceback):
  line 391, in current file
  line 348, in get
  line 318, in upper

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.