[core] Support both dot and dash separators in Version.parse (#14858)

This commit is contained in:
Jonathan Swoboda
2026-03-16 15:45:16 -04:00
committed by GitHub
parent 2f86e48a83
commit c47f4fbc1c
+1 -1
View File
@@ -314,7 +314,7 @@ class Version:
@classmethod
def parse(cls, value: str) -> Version:
match = re.match(r"^(\d+).(\d+).(\d+)-?(\w*)$", value)
match = re.match(r"^(\d+).(\d+).(\d+)[-.]?(\w*)$", value)
if match is None:
raise ValueError(f"Not a valid version number {value}")
major = int(match[1])