diff -r 5698c5eee12b -r 1bd33932713d mercurial/scmutil.py --- a/mercurial/scmutil.py Thu Apr 29 22:01:04 2021 +0200 +++ b/mercurial/scmutil.py Tue Jan 31 11:41:59 2023 +0100 @@ -278,6 +278,11 @@ ) try: int(lbl) + if b'_' in lbl: + # If label contains underscores, Python might consider it an + # integer (with "_" as visual separators), but we do not. + # See PEP 515 - Underscores in Numeric Literals. + raise ValueError raise error.InputError(_(b"cannot use an integer as a name")) except ValueError: pass