Message 162428 - Python tracker
It should raise a SyntaxError, if coding is 'utf8'. I don't agree with the last patch proposed. If the import report a SyntaxError, 'tokenize' should do the same. $ ./python Lib/test/bad_coding2.py File "Lib/test/bad_coding2.py", line 1 SyntaxError: encoding problem: utf-8 and it complies strictly with PEP263.