Jakub Wilk added the comment:
With a slightly adapted test case, I see the same behavior in Python 3.3.3.
Perhaps it would be worth fixing the bug in Python 3.4?
--
Added file: http://bugs.python.org/file33092/test3.py
___
Python tracker
Changes by Benjamin Peterson benja...@python.org:
--
resolution: wont fix -
status: closed - open
versions: +Python 3.4 -Python 2.7
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19942
___
New submission from Jakub Wilk:
I created a Python file which contained a non-UTF-8 string literal (but no
Unicode literals), and added UTF-8 encoding declaration to it. I expected
that Python will raise SyntaxError when importing such module, but it doesn't:
$ python --version
Python 2.7.6
Changes by Jakub Wilk jw...@jwilk.net:
Added file: http://bugs.python.org/file33078/test1.py
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19942
___
___
Changes by Ezio Melotti ezio.melo...@gmail.com:
--
components: +Unicode
nosy: +ezio.melotti, haypo
type: - behavior
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19942
___
Changes by Serhiy Storchaka storch...@gmail.com:
--
nosy: +loewis, serhiy.storchaka
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19942
___
___
Benjamin Peterson added the comment:
Yes, this is a silly bug where we shortcut decoding of utf-8 files by not
checking if its valid UTF-8. However, this behavior has been around for a long
time, so I'm not going to change it in 2.7.x.
--
nosy: +benjamin.peterson
resolution: - wont