[New-bugs-announce] [issue21086] Source with "# -*- coding: ASCII -*-" and UNIX EOL (\n) results in SyntaxError

Morten Z report at bugs.python.org
Fri Mar 28 16:48:48 CET 2014


New submission from Morten Z:

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) ...

----------
components: Interpreter Core
files: hello_unix.py
messages: 215054
nosy: Morten.Z
priority: normal
severity: normal
status: open
title: Source with "# -*- coding: ASCII -*-" and UNIX EOL (\n) results in SyntaxError
type: compile error
versions: Python 3.4
Added file: http://bugs.python.org/file34651/hello_unix.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21086>
_______________________________________


More information about the New-bugs-announce mailing list