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
Python 3.3.4: SyntaxError with correct source code encoding # -*- coding: latin-1 -*- #64930
Comments
The test program: print('test') is correct in Python 3.3.3, but cause this error with Python 3.3.4: I use Windows 7, with bash (of Cygwin) and |
For whatever it's worth, it works fine for me on 3.3 tip on unix. The fact that it says line 3 and shows just a - is suspicious. |
I can reproduce the problem. I started debugging it; the issue is that, after reading the two comment lines (and detecting the source encoding), fileio_readinto gets called, which calls read(), and read() returns 17 (bytes read), with are "-\n\nprint('test')" So for some reason, the - is not consumed yet, even though it was previously read out of the file descriptor. |
Oops, I missed the fact that it was Benjamin that added Serhiy...Benjamin can add himself if he wants :) |
You can avoid this by changing end of line to CRLF. (I don't know why) I attach a simpler test case. |
All works fine with UTF-8. Maybe this issue is important, "First line can be executed twice": |
I can't test on Windows but may be this patch fixes the issue. |
Just in time for 3.3.5... |
New changeset ade5e4922a54 by Martin v. Löwis in branch '3.3': |
Thanks for the patch, this is applied to 3.3 and 3.4. |
Regressions on FreeBSD buildbots (test_coding) |
This needs to be fixed for 3.3.5rc2. |
New changeset dcf4fbf446ca by Benjamin Peterson in branch '3.3': |
Thanks for fixing it. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: