bpo-35766: Merge typed_ast back into CPython by gvanrossum · Pull Request #11645 · python/cpython

@gvanrossum

@gvanrossum

@gvanrossum

@gvanrossum

@gvanrossum

@gvanrossum

@gvanrossum

@gvanrossum

@gvanrossum

@gvanrossum

Demo: `compile(sample, "<sample>", "exec", PyCF_ONLY_AST|0x1000)`
This will crash if type comments are present.

It doesn't *work* yet -- type comments cause crashes in ast.c and type
ignore comments aren't passed on to Module yet.

@gvanrossum

This works, it just needs tests

@gvanrossum

@gvanrossum

This fixes

if 1:
foo()

but does nothing about

def f():
foo()

The latter still reports 'SyntaxError: invalid syntax'.

So this is not a real solution, just a stop-gap measure until I find a better solution.

@gvanrossum

@gvanrossum

@gvanrossum

@gvanrossum

Also:
- remove redundant 'c' argument from new_type_comment()
- double-check that TYPE_COMMENT in a suite is followed by NL

@gvanrossum

ilevkivskyi

@gvanrossum

@gvanrossum

ambv

ambv approved these changes Jan 31, 2019

tyomitch added a commit to tyomitch/cpython that referenced this pull request

Feb 5, 2019
pythonGH-11645 added the fourth option for `mode` argument; updating the comment accordingly.

msullivan added a commit to python/typed_ast that referenced this pull request

Feb 6, 2019
This is mostly cribbed from python/cpython#11645,
though it also adds a new error check to new_type_comment itself.

gvanrossum pushed a commit to python/typed_ast that referenced this pull request

Feb 6, 2019
This is mostly cribbed from python/cpython#11645,
though it also adds a new error check to new_type_comment itself.