summaryrefslogtreecommitdiffstats
path: root/Lib/ast.py
diff options
context:
space:
mode:
authorShantanu <12621235+hauntsaninja@users.noreply.github.com>2022-07-26 09:43:09 (GMT)
committerGitHub <noreply@github.com>2022-07-26 09:43:09 (GMT)
commita5dde0fe4fa13b4ccfec4e27502b19bbbb7e5bb0 (patch)
treecd0b888ed9904ebd0ac665125a5aae9e6aa0a027 /Lib/ast.py
parent0d35a59ce3242b7326890a8c8cc41b321192ec9a (diff)
downloadcpython-a5dde0fe4fa13b4ccfec4e27502b19bbbb7e5bb0.zip
cpython-a5dde0fe4fa13b4ccfec4e27502b19bbbb7e5bb0.tar.gz
cpython-a5dde0fe4fa13b4ccfec4e27502b19bbbb7e5bb0.tar.bz2
gh-95066: ast: Replace assert with ValueError (GH-95072)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Diffstat (limited to 'Lib/ast.py')
-rw-r--r--Lib/ast.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/ast.py b/Lib/ast.py
index 4e2ae85..ebf4529 100644
--- a/Lib/ast.py
+++ b/Lib/ast.py
@@ -42,7 +42,8 @@ def parse(source, filename='<unknown>', mode='exec', *,
flags |= PyCF_TYPE_COMMENTS
if isinstance(feature_version, tuple):
major, minor = feature_version # Should be a 2-tuple.
- assert major == 3
+ if major != 3:
+ raise ValueError(f"Unsupported major version: {major}")
feature_version = minor
elif feature_version is None:
feature_version = -1