mercurial/scmutil.py
changeset 49972 1bd33932713d
parent 49666 4bd12c0f531e
parent 49968 566f7dd563c1
child 50029 28dfb2df4ab9
--- 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