classification
Title: Source with "# -*- coding: ASCII -*-" and UNIX EOL (\n) results in SyntaxError
Type: compile error Stage:
Components: Interpreter Core Versions: Python 3.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Python 3.3.4: SyntaxError with correct source code encoding # -*- coding: latin-1 -*-
View: 20731
Assigned To: Nosy List: Arfrever, Morten.Z, r.david.murray
Priority: normal Keywords:

Created on 2014-03-28 15:48 by Morten.Z, last changed 2014-03-29 14:37 by Morten.Z. This issue is now closed.

Files
File name Uploaded Description Edit
hello_unix.py Morten.Z, 2014-03-28 15:48
hello_win.py Morten.Z, 2014-03-28 15:49
Messages (5)
msg215054 - (view) Author: Morten Z (Morten.Z) Date: 2014-03-28 15:48
Python 3.4 introduced a problem with use of

# -*- coding: ASCII -*-

so when running on Windows, the EOL must be Windows type, and else an error is generated.


See trials below:


C:\>Python34\python.exe hello_unix.py
  File "hello_unix.py", line 3
    II -*-
        ^
SyntaxError: invalid syntax


C:\>Python34\python.exe hello_win.py
Hello Python version 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:24:06) ...


C:\>Python33\python.exe hello_unix.py
Hello Python version 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:18:40) ...


C:\>Python33\python.exe hello_win.py
Hello Python version 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:18:40) ...
msg215056 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-03-28 15:59
Hmm.  This might be related to issue 20731?
msg215058 - (view) Author: Morten Z (Morten.Z) Date: 2014-03-28 16:16
Yes, sounds like a duplicate of http://bugs.python.org/issue20731

But with the fix applied 2014-03-01, is the bug expected to be in 3.4 released 2014-03-17 ?
msg215130 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2014-03-29 14:19
Fix was not cherry-picked to 3.4.0.
Fix will be in 3.4.1.
msg215131 - (view) Author: Morten Z (Morten.Z) Date: 2014-03-29 14:37
Thank you :-D
History
Date User Action Args
2014-03-29 14:37:55Morten.Zsetmessages: + msg215131
2014-03-29 14:19:50Arfreversetstatus: open -> closed

nosy: + Arfrever
messages: + msg215130

superseder: Python 3.3.4: SyntaxError with correct source code encoding # -*- coding: latin-1 -*-
resolution: duplicate
2014-03-28 16:16:30Morten.Zsetmessages: + msg215058
2014-03-28 15:59:46r.david.murraysetnosy: + r.david.murray
messages: + msg215056
2014-03-28 15:49:15Morten.Zsetfiles: + hello_win.py
2014-03-28 15:48:48Morten.Zcreate