diff --git a/mercurial/__init__.py b/mercurial/__init__.py --- a/mercurial/__init__.py +++ b/mercurial/__init__.py @@ -308,12 +308,23 @@ import os import struct from hgdemandimport import py3tokenize as tokenize + from hgdemandimport import py3token as token rootpath = os.path.normpath(os.path.join(os.path.dirname(__file__), '..')) def replacetokens(tokens, fullname): - for i, t in enumerate(tokens): + i = 0 + while i < len(tokens): + t = tokens[i] + + # Function return type annotation. + if t.type == token.OP and t.string == '->': + t2 = tokens[i + 1] + i += 2 + continue + yield t + i += 1 # Header to add to bytecode files. This MUST be changed when # ``replacetokens`` or any mechanism that changes semantics of module diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -177,7 +177,7 @@ def _formatargs(args): return ' '.join(procutil.shellquote(a) for a in args) -def dispatch(req): +def dispatch(req) -> int: """run the command specified in req.args; returns an integer status code""" with tracing.log('dispatch.dispatch'): if req.ferr: