Message205795
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
$ python -c 'import test1' && echo ok
ok
Curiously enough, if I change the declaration to "UTF8", then the exception is raised as expected:
$ sed -e 's/UTF-8/UTF8/' < test1.py > test2.py
$ python -c 'import test2'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "test2.py", line 2
SyntaxError: 'utf8' codec can't decode byte 0xa1 in position 5: invalid start byte |
|
Date |
User |
Action |
Args |
2013-12-10 11:48:59 | jwilk | set | recipients:
+ jwilk |
2013-12-10 11:48:59 | jwilk | set | messageid: <1386676139.88.0.227932494666.issue19942@psf.upfronthosting.co.za> |
2013-12-10 11:48:59 | jwilk | link | issue19942 messages |
2013-12-10 11:48:59 | jwilk | create | |
|