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

Trouble parsing 2.7 code in 3.7 #977

Closed
chebee7i opened this issue Aug 12, 2019 · 4 comments
Closed

Trouble parsing 2.7 code in 3.7 #977

chebee7i opened this issue Aug 12, 2019 · 4 comments

Comments

@chebee7i
Copy link

chebee7i commented Aug 12, 2019

[Turns out the problem wasn't quite what I initially thought.]

The current release (19.3b0) cannot be used using 3.7 on any 2.x code that is trying to be 3.x compatible by using the print function.

In Python 3.7.3 from black commit bd0ab3c

$ cat lala.py
from __future__ import print_function

print('hello', file=sys.stdout)

$ black --target-version=py27 lala.py
error: cannot format lala.py: Cannot parse: 3:19: print('hello', file=sys.stdout)
All done! 💥 💔 💥
1 file failed to reformat.

But if I use the same commit and run from Python 3.6.7, then it works great:

$ # different environment
$ black --target-version=py27 lala.py
reformatted lala.py
All done! ✨ 🍰 ✨
1 file reformatted.
@chebee7i chebee7i changed the title New release? Trouble parsing 2.7 code in 3.7 Aug 12, 2019
@JelleZijlstra
Copy link
Collaborator

I believe this is fixed in master, could you try?

@chebee7i
Copy link
Author

chebee7i commented Aug 12, 2019

Note that in my description I mention that I am running on black commit bd0ab3c, which is the tip of master. Doesn't seem to be fixed.

@JelleZijlstra
Copy link
Collaborator

Sorry for missing that!

@chebee7i
Copy link
Author

Related: #768

However, I am no longer able to reproduce this. Not sure what was going on....maybe some shell woes. Closing until/if I can reproduce it again. Guessing this will come down to user error.

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

No branches or pull requests

2 participants