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

Add missing type_comments attr to ast27.arguments #522

Merged
merged 1 commit into from
Sep 7, 2016

Conversation

Michael0x2a
Copy link
Contributor

This pull request adds a missing attribute from the ast27.arguments class.

@gvanrossum
Copy link
Member

Why does this not also need to be added to ast35?

@Michael0x2a
Copy link
Contributor Author

After checking both the C definitions and testing typed_ast in the console, I found that...

  • In ast35, type information is kept within:
    • ast35.FunctionDef.type_comments
    • ast35.AsyncFunctionDef.type_comments
    • ast35.arg.annotation
  • In ast27, type information is kept within both:
    • ast27.FunctionDef.type_comments
    • ast27.arguments.type_comments (but only when using multi-line comments)

(I also found that ast27 doesn't have an arg node, like ast35 does -- in ast27, function arguments are typically represented by Name nodes).

Out of those five different fields, only ast27.arguments.type_comments is missing. My guess is that field is a relatively new addition, and we just forgot to update typeshed whenever we added support for multi-line comments.

@gvanrossum gvanrossum merged commit a257166 into python:master Sep 7, 2016
@gvanrossum
Copy link
Member

Cool!

@Michael0x2a Michael0x2a deleted the add-missing-attr-to-ast27 branch September 9, 2016 18:51
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.

None yet

3 participants