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

Use ast.parse(type_comments=True) instead of file_tokens on Python 3.8+ #683

Closed
collinanderson opened this issue Mar 22, 2022 · 3 comments · Fixed by #684
Closed

Use ast.parse(type_comments=True) instead of file_tokens on Python 3.8+ #683

collinanderson opened this issue Mar 22, 2022 · 3 comments · Fixed by #684

Comments

@collinanderson
Copy link

Python 3.8 added the ability to include type comments in the abstract syntax tree.

Currently pyflakes uses tokenize to find the comments, which is slow. Using type_comments from ast when available would be much faster.

@asottile
Copy link
Member

maybe a better option would be to drop the type comments support entirely -- now that python 2 is very obsolete

the problem with type_comments=True is pyflakes has no way to signal to flake8 that it needs a special ast parse

@collinanderson
Copy link
Author

Ahh, yeah, that makes sense.

@asottile
Copy link
Member

let's keep this open in case we decide to drop comments

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 a pull request may close this issue.

2 participants