diff options
| author | Claudiu Popa <pcmanticore@gmail.com> | 2019-07-10 10:14:50 +0200 |
|---|---|---|
| committer | Claudiu Popa <pcmanticore@gmail.com> | 2019-07-10 10:14:50 +0200 |
| commit | f58d3c0c33dadca444938af9cd574d192e6166f6 (patch) | |
| tree | 387dcb8e771155961353ac75079641a5f8145c15 | |
| parent | 95dbb7178c44dbc1175ed5e279dab8b7bb02470a (diff) | |
| download | astroid-git-f58d3c0c33dadca444938af9cd574d192e6166f6.tar.gz | |
Obtain type comments on Python 3.8 by passing type_comments=True to the parse function
| -rw-r--r-- | astroid/_ast.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/astroid/_ast.py b/astroid/_ast.py index 027b4603..2e44c1f1 100644 --- a/astroid/_ast.py +++ b/astroid/_ast.py @@ -32,8 +32,11 @@ def _get_parser_module(parse_python_two: bool = False): def _parse(string: str, parse_python_two: bool = False): parse_module = _get_parser_module(parse_python_two=parse_python_two) parse_func = parse_module.parse - if _ast_py3 and not parse_python_two: - parse_func = partial(parse_func, feature_version=sys.version_info.minor) + if _ast_py3: + if PY38: + parse_func = partial(parse_func, type_comments=True) + if not parse_python_two: + parse_func = partial(parse_func, feature_version=sys.version_info.minor) return parse_func(string) |
