diff --git a/parso/utils.py b/parso/utils.py index 76333a02..99a1307b 100644 --- a/parso/utils.py +++ b/parso/utils.py @@ -129,7 +129,7 @@ def version_info(): def _parse_version(version): - match = re.match(r'(\d+)(?:\.(\d{1,2})(?:\.\d+)?)?$', version) + match = re.match(r'(\d+)(?:\.(\d{1,2})(?:\.\d+)?)?((a|b|rc)\d)?$', version) if match is None: raise ValueError('The given version is not in the right format. ' 'Use something like "3.8" or "3".') diff --git a/test/test_utils.py b/test/test_utils.py index 1238e72b..541d81f9 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -89,6 +89,9 @@ def test_bytes_to_unicode_failing_encoding(code, errors): ('3.6', (3, 6)), ('3.6.10', (3, 6)), ('3.10', (3, 10)), + ('3.10a9', (3, 10)), + ('3.10b9', (3, 10)), + ('3.10rc9', (3, 10)), ] ) def test_parse_version_string(version_str, version):