Issue 21086: Source with "# -*- coding: ASCII -*-" and UNIX EOL (\n) results in SyntaxError
Created on 2014-03-28 15:48 by Morten.Z, last changed 2022-04-11 14:58 by admin. 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) * ![]() |
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) * ![]() |
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 |
| 2022-04-11 14:58:00 | admin | set | github: 65285 |
| 2014-03-29 14:37:55 | Morten.Z | set | messages: + msg215131 |
| 2014-03-29 14:19:50 | Arfrever | set | status: open -> closed nosy:
+ Arfrever superseder: Python 3.3.4: SyntaxError with correct source code encoding # -*- coding: latin-1 -*- |
| 2014-03-28 16:16:30 | Morten.Z | set | messages: + msg215058 |
| 2014-03-28 15:59:46 | r.david.murray | set | nosy:
+ r.david.murray messages: + msg215056 |
| 2014-03-28 15:49:15 | Morten.Z | set | files: + hello_win.py |
| 2014-03-28 15:48:48 | Morten.Z | create | |

