typing: correct the signature of error.CommandError stable
authorMatt Harbison <matt_harbison@yahoo.com>
Fri, 24 Mar 2023 02:22:12 -0400
branchstable
changeset 50329 3dbc7b1ecaba
parent 50328 1b3aa9762d3a
child 50330 eb07591825fa
typing: correct the signature of error.CommandError There's a place in `mercurial.dispatch._parse()` that passes None if a parse error happens before the command can be parsed out, and casting the error to bytes works fine because the command and message fields are apparently ignored. Likewise, TortoiseHg similarly passes None for the same reason.
mercurial/error.py
--- a/mercurial/error.py	Fri Mar 24 00:11:38 2023 +0100
+++ b/mercurial/error.py	Fri Mar 24 02:22:12 2023 -0400
@@ -155,7 +155,7 @@
     """Exception raised on errors in parsing the command line."""
 
     def __init__(self, command, message):
-        # type: (bytes, bytes) -> None
+        # type: (Optional[bytes], bytes) -> None
         self.command = command
         self.message = message
         super(CommandError, self).__init__()