diff mercurial/scmutil.py @ 50030:1bd33932713d

branching: merge with stable
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 31 Jan 2023 11:41:59 +0100
parents 4bd12c0f531e 566f7dd563c1
children 28dfb2df4ab9
line wrap: on
line diff
--- 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