mercurial/scmutil.py
branchstable
changeset 49647 566f7dd563c1
parent 49474 b57c95a0f5f9
child 50030 1bd33932713d
--- a/mercurial/scmutil.py	Mon Jan 09 17:48:54 2023 +0100
+++ b/mercurial/scmutil.py	Sat Jan 28 18:26:28 2023 +0400
@@ -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