mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-95066: ast: Replace assert with ValueError (GH-95072)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
This commit is contained in:
parent
0d35a59ce3
commit
a5dde0fe4f
3 changed files with 9 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue