Skip to content

Turn --fast-parser on by default #2734

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

Merged
merged 7 commits into from
Jan 25, 2017
Merged

Turn --fast-parser on by default #2734

merged 7 commits into from
Jan 25, 2017

Conversation

ddfisher
Copy link
Collaborator

Resolves #1353.

Depends on #2710, #2722, and #2730. The first new commit in this PR is "Make --fast-parser the default".

@ddfisher
Copy link
Collaborator Author

Python 3.3 has a different error for print statements that are missing parens (from Objects/exceptions.c, which is currently not duplicated in typed_ast). Hmm.

@ddfisher
Copy link
Collaborator Author

@gvanrossum: This should be ready for review now! There's a lot of test output that's been changed -- let me know if there's some way I can make the review easier.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, what's going on with the Python 3.3 Travis run?


[case testDoubleEncoding2]
# Again the first cookie should be used and fail.
# coding: uft8
# coding: utf8
[out]
file:2: error: Unknown encoding 'uft8'

[case testDoubleEncoding3]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why you had to delete this test and the next?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because they were wrong. Neither of them causes an error when run under Python 3, and when run under mypy with the fast parser there is correctly no error as well. I'll fix the output and add them back (but in parse.test because parse-errors.test can only contain errors).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Adding this test to parse.test fails because we purposefully assume most test cases are ascii in several places, and we mention "portability issues" as part of the reason. I'm going to omit these test cases for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the "portability issues" reason is a feeble excuse, UTF-8 as the default for Python 3 is universal. More likely either there's some code somewhere that doesn't encode/decode right, or it's hard to edit files with UTF-8 in them (I can agree with the latter). But it's fine.

@@ -988,12 +970,11 @@ MypyFile:1(
NameExpr(z)))))

[case testNotAsBinaryOp]
x not y # E: Parse error before "y"
x not is y # E: Parse error before is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically you ought to add a separate test for x not is y

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -3,8 +3,7 @@ in 1
def f():
1 1
[out]
main:1: error: Parse error before in
main:3: error: Parse error before numeric literal
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, this test should be split into two.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, the test should probably just be deleted. It looks like it's supposed to test multiple syntax errors, which we will no longer display.

@ddfisher
Copy link
Collaborator Author

(See my first comment here for what's going on with Python 3.3. I think skipping that test for now is probably reasonable.)

@gvanrossum gvanrossum merged commit 5d93b3e into master Jan 25, 2017
@gvanrossum gvanrossum deleted the fastparser-default branch January 25, 2017 01:37
flebel added a commit to flebel/vim-mypy that referenced this pull request Oct 7, 2017
Since January 2017, it is now enabled by default and the only parser available.
python/mypy#2734
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.

2 participants