Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On python<3.9, get rid of ast.Index before passing AST to PyiVisitor #113

Merged
merged 7 commits into from
Jan 20, 2022

Conversation

Akuli
Copy link
Collaborator

@Akuli Akuli commented Jan 20, 2022

The version-specific special casing has ended up being repeated all over the place. This should clean it up.

While working on this, I noticed that there's a similar situation with ast.Num/ast.Str/etc and ast.Constant. For example, there's isinstance checks with ast.Num, which don't work on newer Pythons:

akuli@akuli-desktop:~$ python3.7 -c 'import ast; print(ast.dump(ast.parse("1")))'
Module(body=[Expr(value=Num(n=1))])
akuli@akuli-desktop:~$ python3.10 -c 'import ast; print(ast.dump(ast.parse("1")))'
Module(body=[Expr(value=Constant(value=1))], type_ignores=[])

I will fix these in a separate PR.

Closes #94

pyi.py Outdated Show resolved Hide resolved
Co-authored-by: Jelle Zijlstra <[email protected]>
pyi.py Outdated Show resolved Hide resolved
@JelleZijlstra JelleZijlstra merged commit f9b1ecf into master Jan 20, 2022
@JelleZijlstra JelleZijlstra deleted the legacy-normalizer branch January 20, 2022 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor subscript logic?
3 participants