-
Notifications
You must be signed in to change notification settings - Fork 891
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
Future imports aren't taken into account when checking syntax #53
Comments
Thank you for reporting this. We're thinking what the best way to handle cases like this is, but in the meantime you can run yapf with --noverify on your code. |
Verification will fail, but can be turned off. #53
Is my solution in #54 workable? I'm happy to modify it if there's anything you'd like changed. |
@flyte To be honest, I'm not sure. There are other ways verification can be tripped (in particular when dealing with the Python 2/3 boundary) and I'm not sure we want to engage in full-scale reparsing just for the sake of verification. |
I thought that may be the case. I wasn't sure how important verification was, and without turning it off this seemed to me like the only way to fix the bug. If you do end up going this way, then something I didn't implement was only scanning the beginning of the file since the 'from future import' lines must be before all other code. This would reduce the cost a fair bit. |
I commented in #54 about the code. IMHO, just adding |
Closing this, as verification is now disabled by default (starting with 7a01d00) Please reopen if you still see this |
This means that code like this will cause a SyntaxError:
with output/traceback like so:
The problem is that each line is taken on its own merit without taking into account imports from future.
The text was updated successfully, but these errors were encountered: