Skip to content

Commit f3d55ff

Browse files
ddfishergvanrossum
authored andcommitted
Always use the default Python 3 version to parse stub files (#3000)
1 parent b418a9f commit f3d55ff

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mypy/fastparse.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ def parse(source: Union[str, bytes], fnam: str = None, errors: Errors = None,
7272
is_stub_file = bool(fnam) and fnam.endswith('.pyi')
7373
try:
7474
assert pyversion[0] >= 3 or is_stub_file
75-
ast = ast3.parse(source, fnam, 'exec', feature_version=pyversion[1])
75+
feature_version = pyversion[1] if not is_stub_file else defaults.PYTHON3_VERSION[1]
76+
ast = ast3.parse(source, fnam, 'exec', feature_version=feature_version)
7677

7778
tree = ASTConverter(pyversion=pyversion,
7879
is_stub=is_stub_file,

0 commit comments

Comments
 (0)